declare @DepartmentName nvarchar(255)
declare @AdminUsername nvarchar(20)
declare @AdminPassword nvarchar(12)
declare @AdminEmail nvarchar(250)

set @DepartmentName = 'Computers'
set @AdminUsername = 'sysadmin'
set @AdminPassword = 'passw0rd'
set @AdminEmail = 'youremail@yourdomain.com'

insert into departments
(DepartmentName)
values
(@DepartmentName)

declare @DepartmentId int
set @DepartmentId = (select id from Departments where DepartmentName = @DepartmentName)

insert into EnquiryCategories
(DepartmentId, CategoryName, AvailableForSelection)
values
(@DepartmentId, 'General', 1)

insert into EnquiryClassifications
(Classification)
values
('None')

insert into EnquirySources
(SourceName)
values
('Email')

insert into EnquirySources
(SourceName)
values
('Fix Your Street')

insert into EnquirySources
(SourceName)
values
('Front Desk')

insert into EnquirySources
(SourceName)
values
('In Person')

insert into EnquirySources
(SourceName)
values
('Phone')

insert into EnquirySources
(SourceName)
values
('Web')

insert into UserGroups
(GroupName)
values
('None')

insert into UserRoles
([Rank], RoleName, RoleDescription)
values
(1, 'Agent', 'Standard User who can add and manage enquiries')

insert into UserRoles
([Rank], RoleName, RoleDescription)
values
(2, 'Department Admin', 'Admin access to enquiries within their department')

insert into UserRoles
([Rank], RoleName, RoleDescription)
values
(3, 'System Admin', 'Admin access to entire system')

declare @GroupId int
declare @RoleId int

set @GroupId = (Select id from UserGroups where GroupName = 'None')
set @RoleId = (Select id from UserRoles where RoleName = 'System Admin')

insert into Users
(DepartmentId, GroupId, Username, Password, Email, DisplayName, FirstPointOfContact, AreaCovered, IsActive)
values
(@DepartmentId, @GroupId, @AdminUsername, @AdminPassword, @AdminEmail, @AdminUsername, 0, '', 1)

declare @UserId int
set @UserId = (select id from users where username = @AdminUsername)

insert into UsersRoles
(UserId, RoleId)
values
(@UserId, @RoleId)